﻿CREATE TABLE [CO].[LedgerOperationsVsTransTypes] (
    [Id]                INT           NOT NULL,
    [LedgerOperationId] INT           NOT NULL,
    [LedgerTransTypeId] INT           NOT NULL,
    [Note]              VARCHAR (250) NULL,
    [MD]                DATETIME      CONSTRAINT [DF__LedgerOperat__MD__2F6FF32E] DEFAULT (getdate()) NOT NULL,
    [MW]                VARCHAR (50)  CONSTRAINT [DF__LedgerOperat__MW__30641767] DEFAULT (suser_sname()) NOT NULL,
    [ToDelete]          BIT           DEFAULT ((0)) NOT NULL,
    CONSTRAINT [PK_LedgerOperationsVsTransTypes] PRIMARY KEY CLUSTERED ([Id] ASC),
    CONSTRAINT [FK_LedgerOperationsVsTransTypes_LedgerOperations] FOREIGN KEY ([LedgerOperationId]) REFERENCES [CO].[LedgerOperations] ([Id]) NOT FOR REPLICATION,
    CONSTRAINT [FK_LedgerOperationsVsTransTypes_LedgerTransTypes] FOREIGN KEY ([LedgerTransTypeId]) REFERENCES [CO].[LedgerTransTypes] ([Id]) NOT FOR REPLICATION
);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Признак того, что запись нужно удалить из БД всех подразделений', @level0type = N'SCHEMA', @level0name = N'CO', @level1type = N'TABLE', @level1name = N'LedgerOperationsVsTransTypes', @level2type = N'COLUMN', @level2name = N'ToDelete';

